package cn.iocoder.yudao.module.erp.dal.mysql.accountinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.accountinfo.AccountInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.erp.controller.admin.accountinfo.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 对账单信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AccountInfoMapper extends BaseMapperX<AccountInfoDO> {

    String getTenantNameById(@Param("tenantId") Long tenantId);

    int updateCostAccountId(@Param("accountId")Long accountId,@Param("ids")List<Long> ids);

    default PageResult<AccountInfoDO> selectPage(AccountInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccountInfoDO>()
                .eqIfPresent(AccountInfoDO::getType, reqVO.getType())
                .eqIfPresent(AccountInfoDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(AccountInfoDO::getAccountGasCount, reqVO.getAccountGasCount())
                .eqIfPresent(AccountInfoDO::getAccountMoneyCount, reqVO.getAccountMoneyCount())
                .betweenIfPresent(AccountInfoDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(AccountInfoDO::getEndTime, reqVO.getEndTime())
                .betweenIfPresent(AccountInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AccountInfoDO::getId));
    }

}